 package com.base.service.system.controller;

import java.util.List;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.base.core.context.annotation.AuthenticationCheck;
import com.base.core.context.mvc.BaseV1Controller;
import com.base.service.system.ao.RoleAO;
import com.base.service.system.ao.RolePageAO;
import com.base.service.system.service.RoleService;
import com.base.service.system.vo.RoleVO;
import com.gitee.magic.framework.head.vo.ObjectVO;
import com.gitee.magic.framework.head.vo.PageVO;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;

/**
 * @author start
 */
@Tag(name = "角色&权限")
@RestController
public class RoleController extends BaseV1Controller {
	
	@Resource
	private RoleService roleService;
	
	@AuthenticationCheck
	@Operation(summary="角色保存")
	@PostMapping("/v1/role")
	public ObjectVO<Long> saveForUpdate(@RequestBody RoleAO ao) {
		return response(roleService.saveForUpdate(ao));
	}
	
	@AuthenticationCheck
	@Operation(summary="角色删除")
	@DeleteMapping("/v1/role")
	public ObjectVO<Integer> remove(@RequestBody List<Long> ao) {
		return response(roleService.remove(ao));
	}

	@AuthenticationCheck
	@Operation(summary="角色分页")
	@PostMapping("/v1/role/page")
	public PageVO<RoleVO> page(@RequestBody RolePageAO ao) {
		return response(roleService.pageWrapper(RoleVO.class, ao));
	}

}
